package com.ctsi.auth.integration.authenticator;

import com.ctsi.auth.integration.IntegrationAuthentication;
import com.ctsi.organise.common.model.UserLogin;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

/**
 * @author zhangjw
 * @className IntegrationAuthenticator
 * @description 集成认证处理接口
 * @date 2019/2/21 14:12
 **/
public interface IntegrationAuthenticator {

    /**
     * 处理集成认证
     * @param integrationAuthentication
     * @return
     */
    UserLogin authenticate(IntegrationAuthentication integrationAuthentication);

    /**
     * 进行预处理，例如参数校验，登陆次数校验等
     * @param integrationAuthentication
     */
    void prepare(IntegrationAuthentication integrationAuthentication) throws OAuth2Exception;

    /**
     * 判断是否支持集成认证类型
     * @param integrationAuthentication
     * @return
     */
    boolean support(IntegrationAuthentication integrationAuthentication);

    /** 认证结束后执行
     * @param integrationAuthentication
     */
    void complete(IntegrationAuthentication integrationAuthentication);

}
